using System;
using log4net;

namespace BlueCrest.ConfigManagement.Core.Logging
{
    [Flags]
    public enum LogLevel
    {
        None = 0,
        Debug = 1,
        Info = 2, 
        Warn = 4, 
        Error = 8,
        All = Debug | Info | Warn | Error,
    }

    public class Logger : ILogger
    {
        private readonly ILog _log4NetLogger;

        public Logger(ILog log4NetLogger)
        {
            _log4NetLogger = log4NetLogger;
        }

        public void Debug(object message)
        {
            _log4NetLogger.Debug(message);
        }

        public void DebugFormat(string message, params object[] args)
        {
            _log4NetLogger.DebugFormat(message, args);
        }

        public void Info(object message) { _log4NetLogger.Info(message); }

        /// <summary>
        /// Message with string.Format like implementations
        /// </summary>
        /// <param name="message"></param>
        /// <param name="args"></param>
        public void Info(string message, params object[] args)
        {
            _log4NetLogger.Info(string.Format(message, args));
        }

        /// <summary>
        /// Message with string.Format like implementations
        /// </summary>
        /// <param name="message"></param>
        /// <param name="args"></param>
        public void InfoFormat(string message, params object[] args)
        {
            _log4NetLogger.InfoFormat(message, args);
        }

        public void Info(string message, Exception exception)
        {
            _log4NetLogger.Info(message, exception);
        }
        
        public void Warn(string message)
        {
            _log4NetLogger.Warn(message);
        }
        
        public void Warn(string message, Exception exception)
        {
            _log4NetLogger.Warn(message, exception);
        }

        public void WarnFormat(string message, params object[] args)
        {
            _log4NetLogger.WarnFormat(message, args);
        }

        public void Error(string message)
        {
            _log4NetLogger.Error(message);
        }

        public void ErrorFormat(string message, params object[] args)
        {
            _log4NetLogger.ErrorFormat(message, args);
        }

        public void Error(string message, Exception exception, params object[] args)
        {
            _log4NetLogger.Error(string.Format(message, args), exception);
        }
    }
}